export const stateMapping = [
    {
        id: 1,
        name: "待派单",
        color: "#8080FF",
        tips: "等待派单中...",
        workOrderState: '1',
    },
    {
        id: 2,
        name: "待接单",
        color: "#F59A23",
        tips: "等待接单中...",
        workOrderState: '2',
    },
    {
        id: 3,
        name: "已接单",
        color: "#52BFCD",
        tips: "师傅已接单，请保持电话畅通",
        workOrderState: '3'
    },
    {
        id: 4,
        name: "处理中",
        color: "#027DB4",
        tips: "处理中，师傅已上传维修前照片",
        workOrderState: '4'
    },
    {
        id: 5,
        name: "待缴费",
        color: "#D9001B",
        tips: "缴费单已生成，请您及时查看缴费单，并缴费",
        workOrderState: '5'
    },
    {
        id: 6,
        name: "已完成",
        color: "#02790E",
        tips: "服务已完成，邀请您对服务进行评价",
        workOrderState: '6'
    },
    {
        id: 7,
        name: "已取消",
        color: "#999999",
        tips: "订单已取消",
        workOrderState: '7'
    },
    {
        id: 8,
        name: "待审核",
        color: "#999999",
        tips: "待审核，请等待管理员审核",
        workOrderState: '8'
    },
    {
        id: 7,
        name: "已评价",
        color: "#97C21C",
        tips: "服务已结束，祝您生活愉快",
        workOrderState: 'estimationFlag'
    }

]

//维修类型映射
export const maintenanceTypeMapping = [
    {
        label: "个人维修",
        value: "1"
    },
    {
        label: "公共维修",
        value: "2"
    }
]

//紧急程度映射
export const urgencyDegreeMapping = [
    {
        label: "普通",
        value: "1"
    },
    {
        label: "紧急",
        value: "2"
    },
    {
        label: "非常紧急",
        value: "3"
    }
]

//通用映射方法
export const commonMapping = function (mapping, value, label = 'label') {
    if (!value) return "";
    let obj = mapping.find(item => item.value === value);
    return obj ? obj[label] : "";
}

